<%@Page Language="VB" %>
<html>
<head>
<!-- #include file="style.inc" -->
</head>
<body>
<!--------------------------------------------------------------------------->
<span class="heading">The ASP Web Forms Control Events</span><p />

<form runat="server">
<table border="0" cellpadding="10"><tr><td nowrap="nowrap" colspan="2">

  <asp:TextBox id="MyText" Text="OriginalValue" runat="server"
       OnTextChanged="MyChangeCode" AutoPostBack="True" />
  <span class="cite">Press 'Tab' to submit Textbox value automatically</span>

</td></tr><tr><td nowrap="nowrap">

  <asp:CheckBox id="MyCheckbox" Text="My CheckBox" runat="server"
       OnCheckedChanged="MyChangeCode" AutoPostBack="True" />

</td><td nowrap="nowrap">

  <asp:DropDownList id="MyDropDownList" runat="server"
       OnSelectedIndexChanged="MyListChangeCode" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="Value 1" />
    <asp:ListItem Text="Option 2" Value="Value 2" />
    <asp:ListItem Text="Option 3" Value="Value 3" />
  </asp:DropDownList>

</td></tr><tr><td nowrap="nowrap">

  <asp:RadioButtonList id="MyRadioList" runat="server"
       OnSelectedIndexChanged="MyListChangeCode" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="Value 1" />
    <asp:ListItem Text="Option 2" Value="Value 2" />
    <asp:ListItem Text="Option 3" Value="Value 3" />
  </asp:RadioButtonList>

</td><td nowrap="nowrap">

  <asp:ImageButton id="MyImageButton" ImageUrl="ClickmeButton.gif" runat="server"
         ImageAlign="absbottom" OnClick="MyImageCode" /><p />

  <asp:Button id="MyButton" Text="Submit" runat="server"
       OnClick="MyClickCode" />

</table>
</form>

<div id="divResult" runat="server" EnableViewState="False" />

<script runat="server">

   Sub MyChangeCode(objSender As Object, objArgs As EventArgs)
     divResult.InnerHtml += "Change event detected for control '" _
                         & objSender.ID & "'<br />"
   End Sub

   Sub MyListChangeCode(objSender As Object, objArgs As EventArgs)
     divResult.InnerHtml += "Change event detected for control '" _
                         & objSender.ID & "'<br />SelectedIndex is '" _
                         & objSender.SelectedIndex _
                         & "', selected item text is '" _
                         & objSender.SelectedItem.Text _
                         & "', selected item value is '" _
                         & objSender.SelectedItem.Value & "'<br />"
   End Sub

   Sub MyClickCode(objSender As Object, objArgs As EventArgs)
     divResult.InnerHtml += "Click event detected for control '" _
                         & objSender.ID & "'<br />"
   End Sub

   Sub MyImageCode(objSender As Object, objArgs As ImageClickEventArgs)
     divResult.InnerHtml += "Click event detected in control '" _
                            & objSender.ID & "' at X=" & objArgs.X _
                            & " Y=" & objArgs.Y & "<br />"
   End Sub


</script>

<!--------------------------------------------------------------------------->
<!-- #include file="foot.inc" -->
</body>
</html>

